<template>
	<!-- 抖音投放链接 -->
	<view class="page-body">
		<!-- 页面内容开始 -->

		<!-- 表格搜索组件开始 -->
		<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns" @search="search">
		</vk-data-table-query>
		<!-- 表格搜索组件结束 -->

		<!-- 自定义按钮区域开始 -->
		<view v-if="showAddBtn">
			<el-row>
				<!-- <el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn"></el-button> -->
				<!-- 批量操作 -->
				<!-- <el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
					<el-button type="danger" size="small" style="margin-left: 20rpx;"
						:disabled="table1.multipleSelection.length === 0">
						批量操作<i class="el-icon-arrow-down el-icon--right"></i>
					</el-button>
					<el-dropdown-menu slot="dropdown">
						<el-dropdown-item :command="1">批量设置回传方案</el-dropdown-item>

					</el-dropdown-menu>
				</el-dropdown> -->
			</el-row>
		</view>
		<!-- 自定义按钮区域结束 -->

		<!-- 表格组件开始 -->
		<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
			:right-btns="['detail_auto','more']" :right-btns-more="table1.rightBtnsMore" :row-no="true"
			:pagination="true" :data-preprocess="table1.dataPreprocess" @update="updateBtn" :selection="true"
			@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange" :border="true"
			:stripe="true">
		</vk-data-table>
		<!-- 表格组件结束 -->

		<!-- 添加或编辑的弹窗开始 -->
		<!-- <vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="700px" mode="form"
			:close-on-click-modal="false" @closed="refresh();">
			<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
				:form-type="form1.props.formType" :columns='form1.props.columns' label-width="160px"
				@success="form1.props.show = false;refresh();"></vk-data-form>
		</vk-data-dialog> -->
		<!-- 添加或编辑的弹窗结束 -->

		<el-dialog title="剧付费卡点" :visible.sync="dialogVisible5" width="700px" :destroy-on-close="true" :center="true"
			:close-on-click-modal="false">
			<el-alert
				:title="'当前账户的用户名：'+vk.vuex.get('$user.userInfo.username')+' , 当前账户的代理商ID：'+vk.vuex.get('$user.userInfo._id')"
				type="error" :closable="false">
			</el-alert>
			<el-alert :title="'当前投放链接id：'+this.tfid+' , 当前剧名：'+this.tv_name" type="success" :closable="false">
			</el-alert>

			<el-input placeholder="请设置付费集数" v-model="setting.tf_start_needpay" type="text">
				<template slot="prepend">设置付费集数</template>
			</el-input>
			<el-input placeholder="请设置付费豆数" v-model="setting.tf_pay_bean" type="text">
				<template slot="prepend">设置付费豆数</template>
			</el-input>
			<view style="padding: 2% 20%;">
				<el-button type="primary" @click="saveSetting">保存</el-button>
			</view>
		</el-dialog>
		<!-- 回传方案设置 -->
		<el-dialog title="设置回传方案" :visible.sync="dialogVisible2" width="900px" :before-close="handleClose2"
			:destroy-on-close="true" :center="true" :close-on-click-modal="false">
			<el-divider></el-divider>
			上次修改时间：{{vk.pubfn.timeFormat(huichuan.last_time,"yyyy-MM-dd hh:mm:ss")}}
			<el-divider></el-divider>

			<view style="padding: 20px 0;">
				<el-switch v-model="huichuan.newuser" inactive-text="仅回传当日新用户的订单">
				</el-switch>
			</view>

			<view style="padding: 20px 0;" v-if="!huichuan.newuser">
				回传用户
				<vk-data-input-number v-model="huichuan.hour_backhaul" width="100px" :precision="0"
					placeholder="请输入数字"></vk-data-input-number>小时内的所有充值
			</view>



			<view class="">
				<el-switch v-model="huichuan.firstorder" inactive-text="仅回传用户的第一笔订单">
				</el-switch>
			</view>



			<el-divider></el-divider>

			<el-radio-group v-model="huichuan.douyinRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>抖音单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.douyinRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.douyin" type="number">
					<template slot="prepend">抖音单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>

			<view style="margin-top: 15px;width: 800px;" v-else>
				<view style="font-size: 15rpx;color: grey;">当选择【循环回传比例】时,左侧值为上报,右侧值为不上报.
					例:若循环回传比为1:2,就是第1笔上报,第2、3笔不上报,第4笔上报,第5、6笔不上报,如此循环.
					<br />开启【循环回传比例】时，建议关闭【仅回传当日新用户的订单】，【仅回传用户的第一笔订单】这两项，否则会影响循环比例的准确性
				</view>
				<view class="" style="margin-top: 15px;width: 800px;display: flex;">
					<el-input placeholder="请输入回传比例" v-model="huichuan.douyin_ReturnRatio" type="number">
						<template slot="prepend">抖音广告循环回传比例：</template>
					</el-input>
					<span style="font-size: 20px;font-weight: 700;margin: 0 15rpx;">:</span>
					<el-input placeholder="请输入不回传比例" v-model="huichuan.douyin_UnReturnRatio" type="number">
					</el-input>
				</view>

			</view>
			<div style="margin-top: 15px;width: 800px; display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model="huichuan.douyinMinPrice" type="number">
					<template slot="prepend">【抖音】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model="huichuan.douyinMaxPrice" type="number">
					<template slot="prepend">【抖音】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>

			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model="huichuan.douyin_url" type="text">
					<template slot="prepend">抖音广告资产化回传URL</template>
				</el-input>
			</div>

			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model="huichuan.douyin_token" type="text">
					<template slot="prepend">抖音广告资产化回传TOKEN</template>
				</el-input>
			</div>


			<el-radio-group v-model="huichuan.kuaishouRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>快手单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.kuaishouRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.kuaishou" type="number">
					<template slot="prepend">快手单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model="huichuan.kuaishou_ReturnRatio" type="number">
					<template slot="prepend">快手广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.kuaishou_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px; display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model="huichuan.kuaishouMinPrice" type="number">
					<template slot="prepend">【快手】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model="huichuan.kuaishouMaxPrice" type="number">
					<template slot="prepend">【快手】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>

			<el-radio-group v-model="huichuan.tengxunRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>腾讯单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.tengxunRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.tengxun" type="number">
					<template slot="prepend">腾讯广告单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model="huichuan.tengxun_ReturnRatio" type="number">
					<template slot="prepend">腾讯广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.tengxun_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model="huichuan.tengxunMinPrice" type="number">
					<template slot="prepend">【腾讯】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model="huichuan.tengxunMaxPrice" type="number">
					<template slot="prepend">【腾讯】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>


			<!-- <el-radio-group v-model="huichuan.ucRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>UC回传比例</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.ucRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.uc" type="number">
					<template slot="prepend">UC广告回传比例：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model="huichuan.uc_ReturnRatio" type="number">
					<template slot="prepend">UC广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.uc_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model="huichuan.ucMinPrice" type="number">
					<template slot="prepend">【UC】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div> -->


			<!-- <el-divider content-position="left">百度广告相关设置</el-divider> -->

			<el-radio-group v-model="huichuan.baiduRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>百度单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.baiduRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.baidu" type="number">
					<template slot="prepend">百度广告单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model="huichuan.baidu_ReturnRatio" type="number">
					<template slot="prepend">百度广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.baidu_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model="huichuan.baiduMinPrice" type="number">
					<template slot="prepend">【百度】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model="huichuan.baiduMaxPrice" type="number">
					<template slot="prepend">【百度】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>

			<div style="margin-top: 15px;width: 800px;display: flex;flex-direction: row;">
				<el-input placeholder="请输入内容" v-model="huichuan.baidu_token" type="text">
					<template slot="prepend">百度回传token：</template>
				</el-input>
				<div style="width: 100px;margin-left: 15px;">
					<el-tooltip class="item" effect="dark" content="详见文档(2.2创建转化追踪-8)" placement="top-end">
						<el-link href="https://dev2.baidu.com/content?sceneType=0&pageId=101211&nodeId=658&subhead="
							target="_blank" :underline="false" type="primary">
							获取token的参考文档</el-link>
					</el-tooltip>
				</div>
			</div>

			<!-- <el-radio-group v-model="huichuan.oppoRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>OPPO回传比例</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.oppoRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.oppo" type="number">
					<template slot="prepend">OPPO广告回传比例：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model="huichuan.oppo_ReturnRatio" type="number">
					<template slot="prepend">OPPO广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.oppo_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model="huichuan.oppoMinPrice" type="number">
					<template slot="prepend">【OPPO】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>
			
			<div style="margin-top: 15px;width: 400px;">
				<el-input placeholder="请输入内容" v-model="huichuan.oppo_owner_id" type="text">
					<template slot="prepend">OPPO->广告主ID：</template>
				</el-input>
			</div>
			
			<div style="margin-top: 15px;width: 400px;">
				<el-input placeholder="请输入内容" v-model="huichuan.oppo_api_id" type="text">
					<template slot="prepend">OPPO->api_id：</template>
				</el-input>
			</div>
			
			<div style="margin-top: 15px;width: 400px;">
				<el-input placeholder="请输入内容" v-model="huichuan.oppo_api_key" type="text">
					<template slot="prepend">OPPO->api_key：</template>
				</el-input>
			</div> -->



			<view style="padding: 2% 20%;">
				<el-button type="primary" @click="saveRebackPercent">保存</el-button>
			</view>

		</el-dialog>

		<!-- 批量回传方案设置 -->
		<el-dialog title="设置回传方案" :visible.sync="dialogVisible3" width="900px" :before-close="handleClose3"
			:destroy-on-close="true" :center="true" :close-on-click-modal="false">
			<el-divider></el-divider>

			<view style="padding: 20px 0;">
				<el-switch v-model.trim="huichuan.newuser" inactive-text="仅回传当日新用户的订单">
				</el-switch>
			</view>

			<view style="padding: 20px 0;" v-if="!huichuan.newuser">
				回传用户
				<vk-data-input-number v-model.trim="huichuan.hour_backhaul" width="100px" :precision="0"
					placeholder="请输入数字"></vk-data-input-number>小时内的所有充值
			</view>



			<view class="">
				<el-switch v-model.trim="huichuan.firstorder" inactive-text="仅回传用户的第一笔订单">
				</el-switch>
			</view>



			<el-divider></el-divider>

			<el-radio-group v-model="huichuan.douyinRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>抖音单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.douyinRadio">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.douyin" type="number">
					<template slot="prepend">抖音单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>

			<view style="margin-top: 15px;width: 800px;" v-else>
				<view style="font-size: 15rpx;color: grey;">当选择【循环回传比例】时,左侧值为上报,右侧值为不上报.
					例:若循环回传比为1:2,就是第1笔上报,第2、3笔不上报,第4笔上报,第5、6笔不上报,如此循环.
					<br />开启【循环回传比例】时，建议关闭【仅回传当日新用户的订单】，【仅回传用户的第一笔订单】这两项，否则会影响循环比例的准确性
				</view>
				<view class="" style="margin-top: 15px;width: 800px;display: flex;">
					<el-input placeholder="请输入回传比例" v-model.trim="huichuan.douyin_ReturnRatio" type="number">
						<template slot="prepend">抖音广告循环回传比例：</template>
					</el-input>
					<span style="font-size: 20px;font-weight: 700;margin: 0 15rpx;">:</span>
					<el-input placeholder="请输入不回传比例" v-model.trim="huichuan.douyin_UnReturnRatio" type="number">
					</el-input>
				</view>

			</view>
			<div style="margin-top: 15px;width: 800px; display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.douyinMinPrice" type="number">
					<template slot="prepend">【抖音】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model.trim="huichuan.douyinMaxPrice" type="number">
					<template slot="prepend">【抖音】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>

			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.douyin_url" type="text">
					<template slot="prepend">抖音广告资产化回传URL</template>
				</el-input>
			</div>

			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.douyin_token" type="text">
					<template slot="prepend">抖音广告资产化回传TOKEN</template>
				</el-input>
			</div>


			<el-radio-group v-model="huichuan.kuaishouRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>快手单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.kuaishouRadio">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.kuaishou" type="number">
					<template slot="prepend">快手单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model.trim="huichuan.kuaishou_ReturnRatio" type="number">
					<template slot="prepend">快手广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.kuaishou_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px; display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.kuaishouMinPrice" type="number">
					<template slot="prepend">【快手】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model.trim="huichuan.kuaishouMaxPrice" type="number">
					<template slot="prepend">【快手】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>

			<el-radio-group v-model="huichuan.tengxunRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>腾讯单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.tengxunRadio">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.tengxun" type="number">
					<template slot="prepend">腾讯广告单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model.trim="huichuan.tengxun_ReturnRatio" type="number">
					<template slot="prepend">腾讯广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model.trim="huichuan.tengxun_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.tengxunMinPrice" type="number">
					<template slot="prepend">【腾讯】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model.trim="huichuan.tengxunMaxPrice" type="number">
					<template slot="prepend">【腾讯】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>


			<!-- <el-radio-group v-model="huichuan.ucRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>UC回传比例</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.ucRadio">
				<el-input placeholder="请输入内容" v-model="huichuan.uc" type="number">
					<template slot="prepend">UC广告回传比例：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model="huichuan.uc_ReturnRatio" type="number">
					<template slot="prepend">UC广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model="huichuan.uc_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model="huichuan.ucMinPrice" type="number">
					<template slot="prepend">【UC】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div> -->


			<!-- <el-divider content-position="left">百度广告相关设置</el-divider> -->

			<el-radio-group v-model="huichuan.baiduRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>百度单笔订单回传概率</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.baiduRadio">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.baidu" type="number">
					<template slot="prepend">百度广告单笔订单回传概率：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model.trim="huichuan.baidu_ReturnRatio" type="number">
					<template slot="prepend">百度广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model.trim="huichuan.baidu_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.baiduMinPrice" type="number">
					<template slot="prepend">【百度】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
				<el-input placeholder="请输入内容" v-model.trim="huichuan.baiduMaxPrice" type="number">
					<template slot="prepend">【百度】订单价格高于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>

			<div style="margin-top: 15px;width: 800px;display: flex;flex-direction: row;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.baidu_token" type="text">
					<template slot="prepend">百度回传token：</template>
				</el-input>
				<div style="width: 100px;margin-left: 15px;">
					<el-tooltip class="item" effect="dark" content="详见文档(2.2创建转化追踪-8)" placement="top-end">
						<el-link href="https://dev2.baidu.com/content?sceneType=0&pageId=101211&nodeId=658&subhead="
							target="_blank" :underline="false" type="primary">
							获取token的参考文档</el-link>
					</el-tooltip>
				</div>
			</div>

			<!-- <el-radio-group v-model="huichuan.oppoRadio" style="margin-top: 15px;">
				<el-radio :label="0" border>OPPO回传比例</el-radio>
				<el-radio :label="1" border>循环回传比例</el-radio>
			</el-radio-group>
			<div style="margin-top: 15px;width: 800px;" v-if="!huichuan.oppoRadio">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.oppo" type="number">
					<template slot="prepend">OPPO广告回传比例：</template>
					<template slot="append">%</template>
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;display: flex;flex-wrap: nowrap;" v-else>
				<el-input placeholder="请输入回传比例" v-model.trim="huichuan.oppo_ReturnRatio" type="number">
					<template slot="prepend">OPPO广告循环回传比例：</template>
				</el-input>
				<span style="font-size: 20px;font-weight: 700;">:</span>
				<el-input placeholder="请输入不回传比例" v-model.trim="huichuan.oppo_UnReturnRatio" type="number">
				</el-input>
			</div>
			<div style="margin-top: 15px;width: 800px;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.oppoMinPrice" type="number">
					<template slot="prepend">【OPPO】订单价格低于：</template>
					<template slot="append">元不回传</template>
				</el-input>
			</div>
			
			<div style="margin-top: 15px;width: 400px;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.oppo_owner_id" type="text">
					<template slot="prepend">OPPO->广告主ID：</template>
				</el-input>
			</div>
			
			<div style="margin-top: 15px;width: 400px;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.oppo_api_id" type="text">
					<template slot="prepend">OPPO->api_id：</template>
				</el-input>
			</div>
			
			<div style="margin-top: 15px;width: 400px;">
				<el-input placeholder="请输入内容" v-model.trim="huichuan.oppo_api_key" type="text">
					<template slot="prepend">OPPO->api_key：</template>
				</el-input>
			</div> -->



			<view style="padding: 2% 20%;">
				<el-button type="primary" @click="saveBatchupRebackPercent">保存</el-button>
			</view>

		</el-dialog>

		<el-dialog title="监测链接复制" :visible.sync="dialogVisible4" width="700px" :before-close="handleClose4"
			:destroy-on-close="true" :center="true" :close-on-click-modal="false">

			<el-button type="success" size="small" @click="douyin">抖音监测链接</el-button>

			<el-button type="success" size="small" @click="kuaishou">快手监测链接</el-button>

			<el-button type="success" size="small" @click="tengxun">腾讯监测链接</el-button>
			<el-button type="success" size="small" @click="baidu">百度监测链接</el-button>
		</el-dialog>

		<!-- 弹窗投放链接今日实时数据开始 -->
		<el-dialog title="投放链接数据预览" :visible.sync="dialogVisible1" width="70%" :before-close="handleClose"
			:destroy-on-close="true" :center="true" :close-on-click-modal="false">
			<view>
				<view style="margin: 20px 0 0 20px;font-size: 40rpx;font-weight: bold;">当前在线人数 {{dqzxrs}} 人</view>
				<view style="margin: 0 0 0 20px;font-size: 40rpx;font-weight: bold;">{{radio1}}</view>
				<el-radio-group v-model="radio1" size="medium" @change="timechange"
					style="margin-left: 30rpx;margin-top: 10rpx;">
					<el-radio-button label="今日数据"></el-radio-button>
					<el-radio-button label="昨日数据"></el-radio-button>
					<el-radio-button label="3天总数据"></el-radio-button>
					<el-radio-button label="7天总数据"></el-radio-button>
					<el-radio-button label="15天总数据"></el-radio-button>
					<el-radio-button label="本月"></el-radio-button>
					<el-radio-button label="上个月"></el-radio-button>
				</el-radio-group>
				<el-date-picker v-model="value2" type="daterange" align="right" unlink-panels range-separator="至"
					start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" :change="change()"
					style="margin-left: 20rpx;">
				</el-date-picker>
				<view style="margin: 0 15px;">
					<view style="display: flex;flex-wrap: wrap;">
						<view class="topbox">
							<text style="color: gray;">新增用户数
								<el-tooltip class="item" effect="dark" content="今日新增的人数" placement="top-end">
									<i style="margin-left: 30rpx;" class="vk-icon-question"></i>
								</el-tooltip>
							</text>
							<view class="numstyle">{{new_add_user||0}}</view>
						</view>
						<view class="topbox">
							<text style="color: gray;">新用户充值金额
								<el-tooltip class="item" effect="dark" content="今日新增用户付费的金额" placement="top-end">
									<i style="margin-left: 30rpx;" class="vk-icon-question"></i>
								</el-tooltip>
							</text>
							<view class="numstyle">¥{{new_users_moneysum||0}}</view>
						</view>
						<view class="topbox">
							<text style="color: gray;">新用户充值人数
								<el-tooltip class="item" effect="dark" content="今日新增用户中付费的人数" placement="top-end">
									<i style="margin-left: 30rpx;" class="vk-icon-question"></i>
								</el-tooltip>
							</text>
							<view class="numstyle">{{newUsers_payNumber||0}}</view>

						</view>
						<view class="topbox">
							<text style="color: gray;">新用户付费率
								<el-tooltip class="item" effect="dark" content="新用户充值人数/新增用户" placement="top-end">
									<i style="margin-left: 30rpx;" class="vk-icon-question"></i>
								</el-tooltip>
							</text>
							<view class="numstyle">{{newUsers_rate||0}}%</view>

						</view>
						<view class="topbox">
							<text style="color: gray;">新用户人均充值
								<el-tooltip class="item" effect="dark" content="新用户充值金额/新增用户数" placement="top-end">
									<i style="margin-left: 30rpx;" class="vk-icon-question"></i>
								</el-tooltip>
							</text>
							<view class="numstyle">￥{{newUsers_pcr||0}}</view>
						</view>
						<view class="topbox">
							<view style="color: gray;">充值金额</view>
							<view class="numstyle">¥{{today_Recharge_amount||0}}</view>
						</view>
						<view class="topbox">
							<text style="color: gray;">充值笔数</text>
							<view class="numstyle">
								{{today_recharges_Number||0}}
							</view>
						</view>
						<view class="topbox">
							<text style="color: gray;">笔单价
								<el-tooltip class="item" effect="dark" content="充值金额/充值笔数" placement="top-end">
									<i style="margin-left: 30rpx;" class="vk-icon-question"></i>
								</el-tooltip>
							</text>
							<view class="numstyle">
								{{today_unit_price||0}}
							</view>
						</view>

					</view>
				</view>
			</view>

			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible1 = false">关 闭</el-button>
			</span>
		</el-dialog>
		<!-- 弹窗投放链接今日实时数据结束 -->
		<!-- 弹窗投放链接每日数据开始 -->
		<el-dialog title="投放链接数据预览" :visible.sync="dialogVisible6" width="70%" :before-close="handleClose6"
			:destroy-on-close="true" :center="true" :close-on-click-modal="false">
			<view>
				<el-table :data="tableData" style="width: 100%">
					<el-table-column prop="date" label="日期">
					</el-table-column>
					<el-table-column prop="drxh" label="当日消耗">
					</el-table-column>
					<el-table-column prop="drcz" label="当日充值">
					</el-table-column>
					<el-table-column prop="jrroi" label="今日ROI">
					</el-table-column>
					<el-table-column prop="gzcb" label="关注成本" width="180">
					</el-table-column>
					<el-table-column prop="xyhffcb" label="新用户付费成本" width="180">
					</el-table-column>
					<el-table-column prop="xyhffl" label="新用户付费率" width="180">
					</el-table-column>
					<el-table-column prop="xyhs" label="新用户数" width="180">
					</el-table-column>
					<el-table-column prop="xyhczje" label="新用户充值金额" width="180">
					</el-table-column>
					<el-table-column prop="xyhczrs" label="新用户充值人数" width="180">
					</el-table-column>
					<el-table-column prop="drczbs" label="当日充值笔数" width="180">
					</el-table-column>
					<el-table-column prop="hcbs" label="回传笔数" width="180">
					</el-table-column>
					<el-table-column prop="ad_id" label="广告账户ID" width="180">
					</el-table-column>
				</el-table>
			</view>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible6 = false">关 闭</el-button>
			</span>
		</el-dialog>
		<!-- 弹窗投放链接每日数据结束 -->
		<!-- 预览充值面板开始页面-->
		<el-dialog title="预览充值面板页面" :visible.sync="dialogVisible9" width="500px" :before-close="handleClose9"
			:destroy-on-close="true" :center="true" :close-on-click-modal="false">
			<view class="boxTemplate">
				<view v-for="(item,index) in this.preview_recharge_plan" :key="index" style="margin-left: 10rpx;">
					<!-- @click="createOrder(item,index)" -->
					<view class="Scheme">
						<view class="Schemecontentss"
							v-if="item.subject == '月度会员' || item.subject == '季度会员' || item.subject == '年度会员'">
							<view class="Judge">{{item.subject}}</view>
							<view class="RechargeAmount">￥{{item.recharge_amount / 100}}</view>
							<view class="RechargeText">{{item.recharge_text}}</view>
						</view>
						<view class="Schemecontent" v-else-if="item.judge == true">
							<view class="Judge">特惠</view>
							<view class="RechargeAmount">￥{{item.recharge_amount / 100}}</view>
							<view class="GiveBean" v-if="item.give_bean">多送{{item.give_bean}}豆</view>
							<view class="RechargeText">{{item.recharge_text}}</view>
							<view class="PercentageUser">{{item.percentage_user || 99}}%的用户选择</view>
						</view>

						<view class="Schemecontents" v-else-if="item.judge == false">
							<view class="RechargeAmount">￥{{item.recharge_amount / 100}}</view>
							<view class="GiveBean" v-if="item.give_bean">多送{{item.give_bean}}豆</view>
							<view class="RechargeText">{{item.recharge_text}}</view>
						</view>
					</view>
				</view>
			</view>


			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible9 = false">关 闭</el-button>
			</span>
		</el-dialog>
		<!-- 预览充值面板结束页面 -->
		<!-- 页面内容结束 -->
	</view>
</template>

<script>
	var that; // 当前页面对象
	var vk = uni.vk; // vk实例
	var originalForms = {}; // 表单初始化数据
	const db = uniCloud.database();
	export default {
		data() {
			// 页面数据变量
			return {
				todayStart: 0,
				pickerOptions: {
					shortcuts: [{
						text: '最近一周',
						onClick(picker) {
							const end = new Date();
							const start = new Date();
							start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
							picker.$emit('pick', [start, end]);
						}
					}, {
						text: '最近一个月',
						onClick(picker) {
							const end = new Date();
							const start = new Date();
							start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
							picker.$emit('pick', [start, end]);
						}
					}, {
						text: '最近三个月',
						onClick(picker) {
							const end = new Date();
							const start = new Date();
							start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
							picker.$emit('pick', [start, end]);
						}
					}]
				},
				value2: '',
				tjsj_item: {},
				radio1: "今日数据",
				//投放链接每日数据相关
				dialogVisible6: false,
				//投放链接每日数据
				tableData: [],
				preview_recharge_plan: [],
				setting: {
					tf_start_needpay: "",
					tf_pay_bean: ""
				},
				huichuan: {
					hour_backhaul: 24,
					douyin_url: "",
					douyin_token: "",
					douyinRadio: 0,
					kuaishouRadio: 0,
					tengxunRadio: 0,
					ucRadio: 0,
					baiduRadio: 0,
					oppoRadio: 0,
					douyin_ReturnRatio: 0,
					douyin_UnReturnRatio: 0,
					kuaishou_ReturnRatio: 0,
					kuaishou_UnReturnRatio: 0,
					tengxun_ReturnRatio: 0,
					tengxun_UnReturnRatio: 0,
					uc_ReturnRatio: 0,
					uc_UnReturnRatio: 0,
					baidu_ReturnRatio: 0,
					baidu_UnReturnRatio: 0,
					oppo_ReturnRatio: 0,
					oppo_UnReturnRatio: 0,
					firstorder: true,
					newuser: false,
					douyin: 100,
					douyinMinPrice: 0,
					douyinMaxPrice: 99999,
					kuaishou: 100,
					kuaishouMinPrice: 0,
					kuaishouMaxPrice: 99999,
					uc: 100,
					ucMinPrice: 0,
					baidu: 100,
					baiduMinPrice: 0,
					baiduMaxPrice: 99999,
					tengxun: 100,
					tengxunMinPrice: 0,
					tengxunMaxPrice: 99999,
					baidu_token: "",
					oppo: 100,
					oppoMinPrice: 0,
					oppo_owner_id: "",
					oppo_api_id: "",
					oppo_api_key: "",
					last_time: 0
				},
				huichuan1: {
					hour_backhaul: 24,
					douyin_url: "",
					douyin_token: "",
					douyinRadio: 0,
					kuaishouRadio: 0,
					tengxunRadio: 0,
					ucRadio: 0,
					baiduRadio: 0,
					oppoRadio: 0,
					douyin_ReturnRatio: 0,
					douyin_UnReturnRatio: 0,
					kuaishou_ReturnRatio: 0,
					kuaishou_UnReturnRatio: 0,
					tengxun_ReturnRatio: 0,
					tengxun_UnReturnRatio: 0,
					uc_ReturnRatio: 0,
					uc_UnReturnRatio: 0,
					baidu_ReturnRatio: 0,
					baidu_UnReturnRatio: 0,
					oppo_ReturnRatio: 0,
					oppo_UnReturnRatio: 0,
					firstorder: true,
					newuser: false,
					douyin: 100,
					douyinMinPrice: 0,
					douyinMaxPrice: 99999,
					kuaishou: 100,
					kuaishouMinPrice: 0,
					kuaishouMaxPrice: 99999,
					uc: 100,
					ucMinPrice: 0,
					baidu: 100,
					baiduMinPrice: 0,
					baiduMaxPrice: 99999,
					tengxun: 100,
					tengxunMinPrice: 0,
					tengxunMaxPrice: 99999,
					baidu_token: "",
					oppo: 100,
					oppoMinPrice: 0,
					oppoMaxPrice: 99999,
					oppo_owner_id: "",
					oppo_api_id: "",
					oppo_api_key: "",
					last_time: 0
				},
				tfid: 0, //临时存放
				invite_code: 0, //临时存放
				tv_name: "", //临时存放
				tv_id: "", //临时存放
				cloudfunction_path: "",
				dialogVisible: false,
				dialogVisible2: false,
				dialogVisible3: false,
				dialogVisible4: false,
				dialogVisible5: false,
				dialogVisible9: false,
				//投放链接今日数据相关
				dialogVisible1: false,
				new_add_user: 0, //新增用户
				new_users_moneysum: 0, //新用户充值金额
				newUsers_payNumber: 0, //新用户充值人数
				newUsers_rate: 0, //新用户付费率
				newUsers_pcr: 0, //新用户人均充值金额
				today_Recharge_amount: 0, //今日充值金额
				today_recharges_Number: 0, //今日充值笔数
				today_unit_price: 0, //笔单价
				dqzxrs: 0, //当前在线人数

				showAddBtn: true,
				domain: uni.getStorageSync("domain"),
				// 页面是否请求中或加载中
				loading: false,
				// init请求返回的数据
				data: {

				},
				// 表格相关开始 -----------------------------------------------------------
				table1: {
					rightBtnsMore: [{
							title: '设置剧付费卡点',
							disabled: (item) => {
								//控制该按钮对哪些数据生效
								// return item._id == '63c54f03819ce8640cced33f'
							},
							onClick: (item) => {
								that = this;
								this.dialogVisible5 = true;
								this.tfid = item._id; //把tfid固定到本地
								this.agentId = item.agentId; //把代理商邀请码固定到本地
								this.tv_name = item.tv_name; //把剧名固定到本地
								this.tv_id = item.tv_id; //把剧id固定到本地
								this.setting.tf_start_needpay = "";
								this.setting.tf_pay_bean = "";
								// vk.callFunction({
								// 	url: 'admin/dls/kh/settingTV/tfljList',
								// 	title: '请求中...',
								// 	data: {
								// 		tfid: that.tfid
								// 	},
								// 	success: (data) => {
								// 		that.setting.tf_start_needpay = data.settingTV.data[0]
								// 			.agent_series;
								// 		that.setting.tf_pay_bean = data.settingTV.data[0].agent_pay;
								// 	}
								// });
								// console.log(item);
							}
						},
						{
							title: '设置回传方案',
							disabled: (item) => {
								//控制该按钮对哪些数据生效
								// return item._id == '63c54f03819ce8640cced33f'
							},
							onClick: (item) => {
								this.dialogVisible2 = true;
								this.tfid = item._id; //把tfid固定到本地
								this.agentId = item.agentId; //把代理商邀请码固定到本地
								this.setCallback(item)
								console.log(this.huichuan);
							}
						}, {
							title: '监测链接',
							disabled: (item) => {
								//控制该按钮对哪些数据生效
								// return item._id == '63c54f03819ce8640cced33f'
							},
							onClick: (item) => {
								console.log("item=", item);
								this.tfid = item._id; //把tfid固定到本地
								this.invite_code = item.agentId; //把代理商邀请码固定到本地
								this.dialogVisible4 = true;
							}
						},
						{
							title: '统计数据',
							disabled: (item) => {

							},
							onClick: (item) => {
								this.tjsj_item = item
								console.log("this.tjsj_item===", this.tjsj_item);
								let start_time = this.todayStart
								let end_time = this.todayStart + 86400000
								this.get_today_number(start_time, end_time, item)
								this.dialogVisible1 = true;
							}
						},
						{
							title: '预览首充充值方案',
							disabled: (item) => {
								//控制该按钮对哪些数据生效
								// return item._id == '63c54f03819ce8640cced33f'
							},
							onClick: (item) => {
								console.log("item=", item);
								this.preview_recharge_plan = item.bind_first_recharge;
								this.dialogVisible9 = true;
							}
						},
						{
							title: '预览非首充充值方案',
							disabled: (item) => {
								//控制该按钮对哪些数据生效
								// return item._id == '63c54f03819ce8640cced33f'
							},
							onClick: (item) => {
								console.log("item=", item);
								this.preview_recharge_plan = item.bind_again_recharge;
								this.dialogVisible9 = true;
							}
						},
						{
							title: '每日数据',
							disabled: (item) => {},
							onClick: (item) => {
								vk.callFunction({
									url: 'admin/dls/kh/dytflj/get_meiri_data',
									title: '请求中...',
									data: {
										item
									},
									success: (data) => {
										this.dialogVisible6 = true;
										this.tableData = data.rows
										console.log(this.tableData)
									}
								});
							}
						},
					],
					dataPreprocess: (list) => {
						// 这里写自己的处理逻辑，最终返回处理完的list即可。
						// list.map((item, index) => {
						// 	item.tfurl = "https://www.xxxx.com/a.html?tfid=" + item._id;
						// });
						return list;
					},
					// 表格数据请求地址
					action: "admin/dls/kh/dytflj/getList",
					// 表格字段显示规则
					columns: [{
							key: "",
							title: "机构账号信息",
							type: "group",
							minWidth: 200,
							align: "left",
							columns: [
								// { "key": "middleman_id", "title": "机构ID", "type": "text" },
								{
									"key": "middleman_username",
									"title": "机构用户名",
									"type": "text"
								},
								{
									"key": "middleman_nickname",
									"title": "机构昵称",
									"type": "text"
								}
							],
						},
						{
							key: "",
							title: "代理商信息",
							type: "group",
							minWidth: 200,
							align: "left",
							columns: [
								// { "key": "agent_id", "title": "代理商ID", "type": "text" },
								{
									"key": "agent_username",
									"title": "代理商用户名",
									"type": "text"
								},
								{
									"key": "agent_nickname",
									"title": "代理商昵称",
									"type": "text"
								}
							],
						},

						{
							key: "",
							title: "广告ID/描述",
							type: "group",
							minWidth: 150,
							align: "left",
							columns: [{
									"key": "ad_id",
									"title": "广告ID",
									"type": "text",
								},
								{
									"key": "desc",
									"title": "描述",
									"type": "text",
								}
							],
						},

						{
							key: "",
							title: "推广链接/小程序路径",
							type: "group",
							minWidth: 500,
							align: "left",
							columns: [{
									"key": "tfurl",
									"title": "投放路径",
									"type": "text",
								},
								{
									"key": "xcxpath",
									"title": "小程序path",
									"type": "text",
								},
								{
									"key": "_id",
									"title": "投放链接id",
									"type": "text",
									"width": 220,
								},
							],
						},
						{
							key: "",
							title: "绑定小程序",
							type: "group",
							minWidth: 220,
							align: "left",
							columns: [{
									key: "appid",
									title: "appid",
									type: "text",
									defaultValue: "未绑定"
								},
								{
									key: "appname",
									title: "小程序名称",
									type: "text",
									defaultValue: "未绑定"
								},
							],
						},
						{
							key: "",
							title: "剧集信息",
							type: "group",
							minWidth: 160,
							align: "left",
							columns: [{
									"key": "tv_name",
									"title": "剧名",
									"type": "text",
								},
								{
									"key": "series",
									"title": "第几集",
									"type": "text",
								},
								{
									"key": "path",
									"title": "页面路径",
									"type": "text"
								}
							],
						}

					],
					// 多选框选中的值
					multipleSelection: [],
					// 当前高亮的记录
					selectItem: ""
				},
				// 表格相关结束 -----------------------------------------------------------
				// 表单相关开始 -----------------------------------------------------------
				// 查询表单请求数据
				queryForm1: {
					// 查询表单数据源，可在此设置默认值
					formData: {

					},
					// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
					columns: []
				},
				form1: {
					// 表单请求数据，此处可以设置默认值
					data: {
						series: 1,
						follow: 0,
						recharge_amount: [],
						domain: uni.getStorageSync("domain"),
						appid: vk.vuex.get('$user.userInfo.appid') || "未绑定小程序",
						appname: vk.vuex.get('$user.userInfo.appname') || "未绑定小程序"
					},
					// 表单属性
					props: {
						// 表单请求地址
						action: "",
						// 表单字段显示规则
						columns: [{
								"key": "ad_id",
								"title": "广告ID",
								"type": "text",
								"tips": "广告账户ID（仅做标记，无实际作用，可不填）"
							},
							{
								"key": "desc",
								"title": "描述",
								"type": "text"
							},
							{
								key: "tv_id",
								title: "选主剧",
								type: "table-select",
								placeholder: "选择",
								action: "admin/pages/kh/dsjzxgl/dsj/getList",
								columns: [{
										key: "tv_name",
										title: "剧名",
										type: "text",
										nameKey: true
									},
									{
										key: "sub_tvname",
										title: "副剧名",
										type: "text"
									},
									{
										key: "_id",
										title: "剧id",
										type: "text",
										width: 260,
										idKey: true
									},
									{
										key: "tv_image",
										title: "封面图",
										type: "image"
									},
								],

								watch: (res) => {
									// console.log("watch", res.option),
									this.form1.data.tv_name = res.option.tv_name
								}
							},
							{
								key: "bind_first_recharge_id",
								title: "绑定充值方案(首充)",
								type: "table-select",
								placeholder: "选择",
								action: "admin/pages/kh/xcxpz/chfagl/getList",
								columns: [{
										key: "subject",
										title: "充值类型",
										type: "text",
									},
									{
										key: "recharge_amount",
										title: "充值金额",
										type: "text"
									},
									{
										key: "bean",
										title: "金豆数",
										type: "text"
									},
									{
										key: "recharge_text",
										title: "充值说明",
										type: "text",
										nameKey: true
									},
									{
										key: "_id",
										title: "id",
										type: "text",
										width: 300,
										idKey: true,
									},
								],
								multiple: true,
								watch: (res) => {
									this.form1.data.bind_first_recharge = res.option
								}
							},
							{
								key: "bind_again_recharge_id",
								title: "绑定充值方案(非首充)",
								type: "table-select",
								placeholder: "选择",
								action: "admin/pages/kh/xcxpz/chfagl/getList",
								columns: [{
										key: "subject",
										title: "充值类型",
										type: "text",
									},
									{
										key: "recharge_amount",
										title: "充值金额",
										type: "text"
									},
									{
										key: "bean",
										title: "金豆数",
										type: "text"
									},
									{
										key: "recharge_text",
										title: "充值说明",
										type: "text",
										nameKey: true
									},
									{
										key: "_id",
										title: "id",
										type: "text",
										width: 300,
										idKey: true
									},
								],
								multiple: true,
								watch: (res) => {
									this.form1.data.bind_again_recharge = res.option
									this.form1.data.recharge_amount = vk.pubfn.arrayObjectGetArray(res.option,
										"recharge_amount");
								}
							},
							{
								"key": "tv_name",
								"title": "剧名",
								"type": "text",
								"disabled": true
							},
							{
								"key": "series",
								"title": "第几集",
								"type": "text",
								"tips": "跳转到哪一集开始播放，一般是第一集"
							},
							{
								"key": "appid",
								"title": "小程序appid",
								"type": "text",
								"tips": "需要跳转到哪个小程序(非常重要)",
								"disabled": true
							},
							{
								"key": "appname",
								"title": "小程序名字",
								"type": "text",
								"tips": "系统默认自动获取，无需填写",
								"disabled": true
							},
							{
								"key": "domain",
								"title": "网页地址",
								"type": "text",
								"disabled": true
							}
							// {
							// 	"key": "follow",
							// 	"title": "是否需要关注",
							// 	"type": "select",
							// 	data: [{
							// 			value: 0,
							// 			label: "不需要关注"
							// 		},
							// 		{
							// 			value: 1,
							// 			label: "关注公众号"
							// 		},
							// 		{
							// 			value: 2,
							// 			label: "关注企业微信"
							// 		}
							// 	]
							// },
							// {
							// 	"key": "gzhId",
							// 	"title": "授权公众号",
							// 	"type": "text"
							// },
							// {"key":"platform","title":"平台","type":"text","width":200}
						],
						// 表单验证规则
						rules: {
							tv_id: [{
								required: true,
								message: "请选择主剧",
								trigger: ['blur', 'change']
							}],
							series: [{
								required: true,
								message: "请输入集数",
								trigger: ['blur', 'change']
							}],
							appid: [{
								required: true,
								message: "请输入正确的appid,否则跳转会出错",
								trigger: ['blur', 'change']
							}],
						},
						// add 代表添加 update 代表修改
						formType: "",
						// 是否显示表单的弹窗
						show: false
					}
				},
				// 其他弹窗表单
				formDatas: {},
				// 表单相关结束 -----------------------------------------------------------
			};
		},
		// 监听 - 页面每次【加载时】执行(如：前进)
		onLoad(options = {}) {
			console.log("domain", uni.getStorageSync("domain"));
			that = this;
			vk = that.vk;
			that.options = options;
			that.init(options);

			vk.callFunction({
				url: 'admin/pages/kh/yhsj/chudian/fnpath',
				title: '请求中...',
				data: {

				},
				success: (data) => {
					console.log("data=", data);
					let path = data.cloudfunction_path.replace('fc-mp-mp', 'fc-mp');
					this.cloudfunction_path = path;
				}
			});
		},
		// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快，会在页面进入动画完成前触发
		onReady() {},
		// 监听 - 页面每次【显示时】执行(如：前进和返回) (页面每次出现在屏幕上都触发，包括从下级页面点返回露出当前页面)
		onShow() {
			let {
				todayStart
			} = vk.pubfn.getCommonTime(new Date());
			this.todayStart = todayStart;

		},
		// 监听 - 页面每次【隐藏时】执行(如：返回)
		onHide() {},
		// 函数
		methods: {
			async change() {
				if (this.value2 == '') {
					return
				}
				let start_time = new Date(this.value2[0]).getTime();
				let end_time = new Date(this.value2[1]).getTime();
				this.get_today_number(start_time, end_time, this.tjsj_item)
			},
			async timechange(e) {
				if (e == "今日数据") {
					let start_time = this.todayStart
					let end_time = this.todayStart + 86400000
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
				if (e == "昨日数据") {
					let start_time = this.todayStart - 86400000
					let end_time = this.todayStart
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
				if (e == "3天总数据") {
					let start_time = this.todayStart - (86400000 * 3)
					let end_time = this.todayStart
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
				if (e == "7天总数据") {
					let start_time = this.todayStart - (86400000 * 7)
					let end_time = this.todayStart
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
				if (e == "15天总数据") {
					let start_time = this.todayStart - (86400000 * 15)
					let end_time = this.todayStart
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
				if (e == "本月") {
					let start_time = vk.pubfn.getCommonTime(new Date()).monthStart
					let end_time = vk.pubfn.getCommonTime(new Date()).monthEnd
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
				if (e == "上个月") {
					let start_time = vk.pubfn.getCommonTime(new Date()).lastMonthStart
					let end_time = vk.pubfn.getCommonTime(new Date()).lastMonthEnd
					console.log(start_time);
					console.log(end_time);
					this.get_today_number(start_time, end_time, this.tjsj_item)
					console.log("e==", e);
				}
			},
			//保存剧卡点设置
			saveSetting() {
				if (this.setting.tf_start_needpay == "" || this.setting.tf_pay_bean == "") {
					this.$message({
						message: '付费集数或付费豆数不能为空',
						type: 'error'
					});
				} else {
					vk.callFunction({
						url: 'admin/dls/kh/settingTV/add',
						title: '请求中...',
						data: {
							tfid: this.tfid,
							tv_id: this.tv_id,
							tv_name: this.tv_name,
							agent_series: this.setting.tf_start_needpay,
							agent_pay: this.setting.tf_pay_bean,

						},
						success: (data) => {
							this.$message({
								message: '保存成功',
								type: 'success'
							});
						}
					});
				}

			},
			get_today_number(start_time, end_time, item) {
				vk.callFunction({
					url: 'admin/dls/kh/dytflj/tflink_today_data',
					title: '请求中...',
					data: {
						item,
						start_time,
						end_time
					},
					success: (data) => {
						this.dqzxrs = data.dqzxrs; //当前在线人数
						// console.log("data=>", data);
						this.new_add_user = data.num; //新增用户数
						this.new_users_moneysum = vk.pubfn.toDecimal(data
							.new_users_moneysum / 100,
							2); //新用户充值金额
						this.newUsers_payNumber = data.newUsers_payNumber; //新用户充值人数
						this.newUsers_rate = vk.pubfn.toDecimal(data
							.newUsers_payNumber / data.num * 100,
							2); //新用户付费率
						this.newUsers_pcr = vk.pubfn.toDecimal(this
							.new_users_moneysum / data.num,
							2); //新用户人均充值金额
						this.today_Recharge_amount = vk.pubfn.toDecimal(data
							.today_Recharge_amount / 100,
							2); //今日充值金额
						this.today_recharges_Number = data
							.today_recharges_Number; //今日充值笔数
						this.today_unit_price = vk.pubfn.toDecimal(this
							.today_Recharge_amount / this
							.today_recharges_Number, 2) //笔单价
					}
				});
			},
			async setCallback(item) {
				// console.log("22222222222222222222222222",item._id);
				let huichuans = await db.collection('a_config').where({
					tfid: item._id
				}).get()
				// console.log("11111111111111111",huichuans.result.data[0]);
				this.huichuan = huichuans.result.data[0]
			},
			// 保存回传比例
			saveRebackPercent() {
				this.dialogVisible2 = false;
				//对提交的字符串去除首尾空格
				if (this.huichuan.douyin_url != '' && this.huichuan.douyin_url != null) {
					this.huichuan.douyin_url = this.huichuan.douyin_url.trim()
				}
				if (this.huichuan.douyin_token != '' && this.huichuan.douyin_token != null) {
					this.huichuan.douyin_token = this.huichuan.douyin_token.trim()
				}
				if (this.huichuan.baidu_token != '' && this.huichuan.baidu_token != null) {
					this.huichuan.baidu_token = this.huichuan.baidu_token.trim()
				}
				if (this.huichuan.oppo_owner_id != '' && this.huichuan.oppo_owner_id != null) {
					this.huichuan.oppo_owner_id = this.huichuan.oppo_owner_id.trim()
				}
				if (this.huichuan.oppo_api_id != '' && this.huichuan.oppo_api_id != null) {
					this.huichuan.oppo_api_id = this.huichuan.oppo_api_id.trim()
				}
				if (this.huichuan.oppo_api_key != '' && this.huichuan.oppo_api_key != null) {
					this.huichuan.oppo_api_key = this.huichuan.oppo_api_key.trim()
				}
				//用户选择循环模式则直接把普通模式回传比例设为100
				if (this.huichuan.douyinRadio == 1) {
					this.huichuan.douyin = 100
				}
				if (this.huichuan.kuaishouRadio == 1) {
					this.huichuan.kuaishou = 100
				}
				if (this.huichuan.tengxunRadio == 1) {
					this.huichuan.tengxun = 100
				}
				if (this.huichuan.ucRadio == 1) {
					this.huichuan.uc = 100
				}
				if (this.huichuan.baiduRadio == 1) {
					this.huichuan.baidu = 100
				}
				if (this.huichuan.oppoRadio == 1) {
					this.huichuan.oppo = 100
				}
				// console.log(this.huichuan);
				// vk.callFunction({
				// 	url: 'agent/setting/kh/RebackPercent',
				// 	title: '请求中...',
				// 	data: {
				// 		type: "save",
				// 		tfid: this.tfid,
				// 		huichuan: this.huichuan
				// 	},
				// 	success: (data) => {
				// 		this.$message({
				// 			message: '保存成功',
				// 			type: 'success'
				// 		});
				// 		this.dialogVisible2 = false;
				// 	}
				// });

			},
			douyin() {
				let dataurl =
					"/agent/callback/pub/ttcallback?pt=douyin&timestamp=__TS__&ip=__IP__&aid=__AID__&cid=__CID__&advertiser_id=__ADVERTISER_ID__&os=__OS__&ua=__UA__&callback=__CALLBACK_PARAM__&project_id=__PROJECT_ID__&promotion_id=__PROMOTION_ID__&tfid=" +
					this.tfid + "&invite_code=" + this.invite_code;
				this.copy_url("抖音", dataurl)
			},

			kuaishou() {
				let dataurl =
					"/agent/callback/pub/kscallback?pt=kuaishou&timestamp=__TS__&ip=__IP__&aid=__AID__&cid=__CID__&did=__DID__&ua=__UA__&callback=__CALLBACK_PARAM__&tfid=" +
					this.tfid + "&invite_code=" + this.invite_code;
				this.copy_url("快手", dataurl)
			},



			tengxun() {
				let dataurl =
					"/agent/callback/pub/tengxun?pt=tengxun&account_id=__ACCOUNT_ID__&click_id=__CLICK_ID__&click_time=__CLICK_TIME__&device_os_type=__DEVICE_OS_TYPE__&adgroup_id=__ADGROUP_ID__&ad_id=__AD_ID__&ip=__IP__&user_agent=__USER_AGENT__&callback=__CALLBACK__&tfid=" +
					this.tfid + "&invite_code=" + this.invite_code;
				this.copy_url("腾讯(广点通)", dataurl)
			},

			baidu() {
				let dataurl =
					"/agent/callback/pub/baidu?pt=baidu&aid=__IDEA_ID__&pid=__PLAN_ID__&uid=__UNIT_ID__&userid=__USER_ID__&click_id=__CLICK_ID__&ip=__IP__&ua=__UA__&os=__OS__&ts=__TS__&bd_vid=__BD_VID__&bd_vid=__BD_VID__&ext_info=__EXT_INFO__&tfid=" +
					this.tfid + "&invite_code=" + this.invite_code;
				this.copy_url("百度", dataurl)
			},

			copy_url(pt, dataurl) {
				let full_link = this.cloudfunction_path + dataurl
				uni.showModal({
					title: pt + "监测链接如下：",
					content: full_link,
					confirmText: "复制",
					showCancel: false,
					success(res) {
						if (res.confirm) {
							uni.setClipboardData({
								data: full_link,
								success() {
									vk.toast('复制成功');
								}
							})
						}
					}
				})
			},
			handleClose() {
				this.dialogVisible1 = false;
			},
			handleClose2() {
				this.dialogVisible2 = false;
			},
			handleClose3() {
				this.dialogVisible3 = false;
			},
			handleClose4() {
				this.dialogVisible4 = false;
			},
			handleClose5() {
				this.dialogVisible5 = false;
			},
			handleClose6() {
				this.dialogVisible6 = false;
			},
			handleClose9() {
				this.dialogVisible9 = false;
			},
			// 页面数据初始化函数
			init(options) {
				originalForms["form1"] = vk.pubfn.copyObject(that.form1);
			},
			// 页面跳转
			pageTo(path) {
				vk.navigateTo(path);
			},
			// 表单重置
			resetForm() {
				vk.pubfn.resetForm(originalForms, that);
			},
			// 搜索
			search() {
				that.$refs.table1.search();
			},
			// 刷新
			refresh() {
				location.reload()
				that.$refs.table1.refresh();
			},
			// 获取当前选中的行的数据
			getCurrentRow() {
				return that.$refs.table1.getCurrentRow();
			},
			// 监听 - 行的选中高亮事件
			currentChange(val) {
				that.table1.selectItem = val;
			},
			// 当选择项发生变化时会触发该事件
			selectionChange(list) {
				that.table1.multipleSelection = list;
			},
			// 显示添加页面
			addBtn() {
				that.resetForm();
				that.form1.props.action = 'admin/dls/kh/dytflj/add';
				that.form1.props.formType = 'add';
				that.form1.props.title = '添加';
				that.form1.props.show = true;
			},
			// 显示修改页面
			updateBtn({
				item
			}) {
				that.form1.props.action = 'admin/dls/kh/dytflj/update';
				that.form1.props.formType = 'update';
				that.form1.props.title = '编辑';
				that.form1.props.show = true;
				that.form1.data = item;
			},
			// 删除按钮
			deleteBtn({
				item,
				deleteFn
			}) {
				deleteFn({
					action: "admin/dls/kh/dytflj/delete",
					data: {
						_id: item._id
					},
				});
			},
			//批量设置回传方案
			saveBatchupRebackPercent() {

				// vk.callFunction({
				// 	url: 'agent/setting/kh/batchup',
				// 	title: '请求中...',
				// 	data: {
				// 		lists: this.table1.multipleSelection,
				// 		huichuan: this.huichuan
				// 	},
				// 	success: (data) => {
				// 		this.huichuan = this.huichuan1
				// 		vk.alert('批量设置完成!');
				// 		this.refresh()
				// 		this.dialogVisible3 = false;

				// 	}
				// });
			},
			// 监听 - 批量操作的按钮点击事件
			batchBtn(index) {
				switch (index) {
					case 1:

						this.dialogVisible3 = true;
						this.huichuan = this.huichuan1

						break;
					case 2:
						vk.toast("批量操作按钮2");
						break;
					default:
						break;
				}
			}
		},
		// 监听属性
		watch: {

		},
		// 过滤器
		filters: {

		},
		// 计算属性
		computed: {

		}
	};
</script>
<style lang="scss" scoped>
	.page-body {}


	.topbox {
		width: 23%;
		height: 90px;
		display: flex;
		flex-direction: column;
		justify-content: space-evenly;
		/* box-shadow: 0 4rpx 8rpx 0 rgba(0, 0, 0, 0.2), 0 6rpx 20rpx 0 rgba(0, 0, 0, 0); */
		margin: 20px 20px 0rpx 0;
		padding: 15px 30px;
		border-radius: 10rpx;
		background-color: #fff;
	}

	.box2 {
		width: 95%;
		display: flex;
		flex-wrap: wrap;
		box-shadow: 0 4rpx 8rpx 0 rgba(0, 0, 0, 0.2), 0 6rpx 20rpx 0 rgba(0, 0, 0, 0);
		margin: 20rpx;
		padding: 20rpx;
		border-radius: 20rpx;
	}

	.numstyle {
		color: #4c4c4c;
		font-size: larger;
		/* font-weight: bold; */
	}

	/* 请根据实际需求修改父元素尺寸，组件自动识别宽高 */
	.charts-box {
		width: 100%;
		height: 450px;
	}

	.boxTemplate {
		width: 800rpx;
		margin: 0 auto;
		display: flex;
		flex-wrap: wrap;

		.Scheme {
			width: 350rpx;
			height: 180rpx;
			margin: 20rpx 0;

			.Schemecontent {
				width: 94%;
				height: 180rpx;
				border-radius: 12rpx;
				margin: 0 auto;
				position: relative;
				background-image: url("../../../static/tehui.png");
				background-size: 100% 180rpx;

				view {
					position: absolute;
				}

				.Judge {
					padding: 0px 40rpx;
					text-align: center;
					color: #e5563b;
					background-image: url("../../../static/tehuis.png");
					background-size: 100% 100%;
					border-radius: 12rpx 0 12rpx 0;
					font-size: 26rpx;
					font-weight: 600;
				}

				.RechargeAmount {
					font-weight: 600;
					font-size: 36rpx;
					left: 5%;
					top: 25%;
				}

				.GiveBean {
					padding: 0 20rpx;
					font-size: 24rpx;
					font-weight: 600;
					background-color: #f55125;
					color: #fff;
					border-radius: 50rpx;
					left: 40%;
					top: 29%;
				}

				.RechargeText {
					font-size: 28rpx;
					font-weight: 600;
					left: 8%;
					bottom: 23%;
				}

				.PercentageUser {
					color: #e37f75;
					font-size: 24rpx;
					font-weight: 600;
					right: 20rpx;
					bottom: 10rpx;
				}
			}

			.Schemecontents {
				width: 94%;
				height: 180rpx;
				border-radius: 12rpx;
				margin: 0 auto;
				background-color: #e8e8e8;
				position: relative;


				view {
					position: absolute;
				}


				.RechargeAmount {
					font-weight: 600;
					font-size: 36rpx;
					left: 3%;
					top: 20%;
				}

				.GiveBean {
					padding: 0rpx 20rpx;
					font-size: 24rpx;
					font-weight: 600;
					background-color: #f55125;
					color: #fff;
					border-radius: 50rpx;
					left: 38%;
					top: 24%;
				}

				.RechargeText {
					font-size: 24rpx;
					font-weight: 600;
					left: 5%;
					bottom: 20%;
				}
			}

			.Schemecontentss {
				width: 94%;
				height: 180rpx;
				border-radius: 14rpx;
				margin: 0 auto;
				position: relative;
				background-image: url("../../../static/huiyuan.png");
				background-size: 100% 180rpx;

				view {
					position: absolute;
				}

				.Judge {
					padding: 0px 40rpx;
					text-align: center;
					color: #e5563b;
					background-color: #fafc43;
					border-radius: 12rpx 0 12rpx 0;
					font-size: 26rpx;
					font-weight: 600;
				}

				.RechargeAmount {
					color: #ffffff;
					font-weight: 600;
					font-size: 32rpx;
					left: 5%;
					top: 25%;
				}

				.RechargeText {
					color: #f2e4d8;
					font-size: 28rpx;
					font-weight: 500;
					left: 5%;
					bottom: 20%;
				}

			}
		}
	}
</style>